import asyncio
import time

import websockets

async def client():
    s = time.time()
    async with websockets.connect("ws://localhost:8765") as websocket:
        print(time.time() - s)
        message = "Hello Server"
        await websocket.send(message)
        print(f"已发送消息: {message}")

        response = await websocket.recv()
        print(f"收到服务器响应: {response}")

        # 在此进行进一步处理
        processed = f"客户端处理结果: {response.split(': ')[1]}"
        print(processed)

asyncio.new_event_loop().run_until_complete(client())